import { types } from 'mobx-state-tree';

const Todo = types.model({
  name: types.optional(types.string, ''),
  done: types.optional(types.boolean, false),
});

const User = types.model({
  name: types.optional(types.string, ''),
});

const RootStore = types.model({
  users: types.map(User),
  todos: types.optional(types.map(Todo), {}),
});

const store = RootStore.create({
  users: {
    liyongal: { name: 'Li Yong' },
  }, // users is not required really since arrays and maps are optional by default since MST3
});

export default store;
